import {useEffect, useRef} from "react";
import {init} from 'echarts';

export default function Index() {
    const chartRef = useRef()
    useEffect(() => {
        const myChart = init(chartRef.current)
        myChart.setOption({
            title: {
              text: 'react'
            },
            xAxis: {
                type: 'category',
                data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
            },
            yAxis: {
                type: 'value'
            },
            series: [
                {
                    data: [150, 230, 224, 218, 135, 147, 260],
                    type: 'line'
                }
            ]
        })
    }, []);
    return (
        <div>
            <div ref={chartRef} style={{ height: '400px', width: '400px' }}></div>
        </div>
    )
}
